<!DOCTYPE html>
<html>
<head>
	<title>component is</title>
	<meta charset="UTF-8">
	<script src="./vue.js"></script>
</head>
<body>
	<div id="app">
		<component :is="type"></component>
		<button @click="handleToggle">toogle</button>
	</div>

	<script>
		Vue.component('child-one', {template: `<div>one ${new Date().toLocaleString()}</div>`})
		Vue.component('child-two', {template: `<div>two ${new Date().toLocaleString()}</div>`})

		var app = new Vue({
			el: '#app',
			data: function () {
				return {
					type: 'child-two'
				}
			},
			methods: {
				handleToggle: function () {
					this.type = this.type === 'child-one' ? 'child-two' : 'child-one'
				}
			}
		})
	</script>

</body>
</html>